package edu.friday.repository;
import edu.friday.model.SysUser;
import edu.friday.repository.custom.SysUserCustomerRepository;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * 用户表 数据层
 */
@Repository
public interface SysUserRepository extends JpaRepository<SysUser, Long>, SysUserCustomerRepository {
    @Modifying
    @Query(value = " update sys_user set del_flag = '2' where user_id in :userIds ", nativeQuery = true)
    int deleteByUserIds(@Param("userIds") Long[] userIds);
    @Modifying
    @Query(value = " delete from sys_user_role where user_id=:userId ", nativeQuery = true)
    int deleteUserRoleByUserId(@Param("userId")Long userId);

    @Modifying
    @Query(value = "select * ",nativeQuery=true)
    SysUser selectUserByUserName(@Param("userName") String userName);
}